package com.example.rlw.mvpplugintest.takephoto;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import okhttp3.MediaType;
import okhttp3.RequestBody;

/**
 * 描述：
 * Created by rlw on 2019/3/20.
 */
public class UploadModel {
    public void upLoadFile(TestBean bean) {
        HashMap<String, RequestBody> map = new HashMap<>();
        List<File> imageFiles = new ArrayList<>();
        if (bean.getImagePaths().size() > 0) {
            for (int i = 0; i < bean.getImagePaths().size(); i++) {
                File file = new File(bean.getImagePaths().get(i));
                imageFiles.add(file);
                RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
                map.put("images\"; filename=\"" + file.getName(), requestBody);
            }
        }
//        NetWorks.configRetrofit(UpLoadService.class)
//                .uploadPatrolRecord(map, bean.getAddress(), bean.getClassId(), bean.getContent(), bean.getLongLatValue(), bean.getPlanId())
//                .compose(new MyObservableTransformer<>())
//                .subscribe(new BaseObserver<Integer>(callBack) {
//                    @Override
//                    public void onSuccess(Integer data, String msg) {
//                        callBack.onSuccessful(data, msg);
//                    }
//                });
    }
}
